<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>添加会员</title>
<%@include file="../collect/meta.jsp"%>
<script src="${ctx}/js/md5.js"></script>
<link rel="stylesheet" href="css/radius.css" type="text/css"></link>
<script type="text/javascript" src="${ctx}/js/returnTop.js"></script>
</head>
<body lang="zh-cn">
	<div class="wrapper">
		<c:import url="/muser/musertop.jsp"></c:import>
		<div class="main-container" id="main-container">
			<div class="main-container-inner">
				<c:import url="/muser/muserleft.jsp"></c:import>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<ul class="breadcrumb">
							<li><i class="icon-home home-icon"></i>添加会员</li>
						</ul>
						<!-- .breadcrumb -->
					</div>
					<div class="page-content">
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								<form action="member!addMember?addplace=user"
									name="registerForm" id="registerForm" method="post">
									<fieldset>
										<legend align="center">添加会员</legend>
										<div align="center">
											<table>
												<tr>
													<td height="60"><div align="right">
															<strong>手机号:</strong>
														</div>
													</td>
													<td><input type="text" id="mobile"
														name="member.mobile" placeholder="手机号不可修改">
													</td>
													<td><div align="left" id="one"></div>
													</td>
												</tr>
												<tr>
													<td height="60"><div align="right">
															<strong>姓名:</strong>
														</div>
													</td>
													<td><input type="text" id="name" name="member.name">
													</td>
													<td><div align="left" id="three"></div>
													</td>
												</tr>
												<!--  
		                        <tr>
		                           <td height="60"><div align="right"><strong>密码:</strong></div></td>
		                           <td><input type="password" id="password" name="member.password" placeholder="密码"></td>
		                           <td><div align="left" id="two"></div></td>
		                        </tr>
		                        -->
												<tr>
													<td height="60" colspan="3">
														<div align="center">
															<button type="button"
																class="btn btn-primary radius btn-sm"
																onclick="verifyRegister(this);">确认添加</button>
														</div></td>
												</tr>
												<tr>
													<td height="60" colspan="3">
														<div align="center">
															<b id="backMessage" style="font-size:25px;color:red;">${result
																}</b>
														</div></td>
												</tr>
											</table>
										</div>
									</fieldset>
								</form>
								<!-- PAGE CONTENT ENDS -->
							</div>
							<!-- /.col -->
						</div>
						<!-- /.row -->
					</div>
					<!-- /.page-content -->
				</div>
				<!-- /.main-content -->
			</div>
			<!-- /.main-container-inner -->
			<a href="#" id="btn-scroll-up"
				class="btn-scroll-up btn btn-sm btn-inverse"
				style="position:fixed;bottom:0;"> <i
				class="icon-double-angle-up icon-only bigger-110"></i> </a>
		</div>
		<!-- /.main-container -->
		<div class="push"></div>
	</div>
	<c:import url="/collect/down.jsp"></c:import>
</body>
<script type="text/javascript">
	function verifyRegister(btn) {
		var mobile = document.getElementById("mobile").value;
		mobileReg = /^1[3|4|5|8][0-9]\d{8}$/;
		if (mobile.length == 0) {
			alert("请填写手机号！");
			return false;
		} else if (!mobileReg.test(mobile)) {
			alert("不是完整的11位手机号或者正确的手机号前3位！");
			return false;
		}

		var name = document.getElementById("name").value;
		var re = /^[\u4e00-\u9fa5a-z]+$/gi;
		if (!re.test(name)) {
			alert("名称中含有特殊字符！");
			return false;
		}

		btn.disabled = true;
		
		registerForm.submit();
	}

	$(document).ready(
			function() {
				$('.addmuser > a').css("color","red");
				setTimeout("$('#backMessage').hide()", 5000);
				/*
				$("#mobile").blur(
						function() {
							// 验证手机号
							var mobile = $("input[id='mobile']").val();
							if (mobile.length == 0) {
								$("div[id='one']").html(
										"<font color='red'>请输入手机号</font>");
								return false;
							} else {
								$("div[id='one']").html("");
							}
							$.ajax({
								async : false,
								url : "member!verifyMobile",
								type : "post",
								data : {
									"mobile" : mobile
								},
								datatype : "json",
								success : function(data) {
									var map = eval("(" + data + ")");
									if (map == null) {
										sub = true;
										$("div[id='one']").html("");
									} else {
										sub = false;
										$("div[id='one']").html(
												"<font color='red'>" + map.temp
														+ "</font>");
									}
								},
								error : function(request) {
									sub = false;
									alert("Connection error");
								}
							});
						});
						*/
			}

	);
</script>
</html>
